#include <stdio.h>

//利用函数实现二分查找
int Two_find(int arr[], int k, int sz) {
    int left = 0;
    int right = sz - 1;
    while (left <= right) {
        int mid = (left + right) / 2;
        if (arr[mid] < k) {
            left = mid + 1;
        } else if (arr[mid] > k) {
            right = mid - 1;
        } else {
            return mid;
        }
    }
    if (left > right) {}
}

int main() {
    int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    int sz = sizeof(arr) / sizeof(arr[0]);
    int k = 0;
    scanf("%d", &k);
    int ret = Two_find(arr, k, sz);
    if (ret == -1) {
        printf("没找到\n");
    } else {
        printf("找到了，下标是%d\n", ret);
    }
    return 0;
}
